<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>购物车</title>
	<link rel="stylesheet" href="css/jd_shopcarcss.css" />
	<link rel="stylesheet" href="css/jd_shopcar.css" />
	<link rel="stylesheet" href="font/css/font-awesome.min.css" />
	<script type="text/javascript" src="Public/org/jquery.min.js"></script>
	<script type="text/javascript" src="js/jd_topad.js" ></script>
	<script type="text/javascript" src="js/jd_shopcar.js" ></script>
	<link rel="stylesheet" type="text/css" href="Public/org/hdjs/hdjs.css">
	<script type="text/javascript" src='Public/org/hdjs/hdjs.min.js' ></script>
	<script type="text/javascript" src='Public/org/common.js' ></script>
</head>
<body>

	<!-- 左边导航条 -->
	<!-- 顶部导航区域开始  -->
	<div id="topad">
		<div class="center">

			<ul style="float:right;width:auto;">
				<?php if (isset($_SESSION['user_id'])): ?>
					<li class="a"><a class="hello" href="<?php echo U('Member/User/myInfo') ?>"><?php echo $_SESSION['username'] ?></a><a class="login" href="<?php echo U('Member/User/quit') ?>">退出</a><span class="line"></span></li>
				<?php else: ?>
					<li class="a"><a class="hello" href="<?php echo U('Member/User/login') ?>">你好，请登录</a><a class="login" href="<?php echo U('Member/User/register') ?>">免费注册</a><span class="line"></span></li>
				<?php endif ?>

				<li><a href="<?php echo U('Member/Index/order') ?>">我的订单</a><span class="line"></span></li>
				<li class="a side"><a href="<?php echo U('Member/Index/myInfo') ?>">我的京东</a>

				</li>

			</ul>
		</div>
	</div>
	<!-- 顶部导航区域结束 -->
	<!-- 搜索区域开始-->
	<div id="search">
		<img src="images/logo-201305.jpg" height="60" width="270" alt="" class="jd" />
		<!-- <img src="image/phone/cart-icon.png" height="70" width="100" alt="" class="jdlogo" /> -->
		<form action="" class="search">
			<input class="text" type="text"  value="金龙鱼" />
			<input type="submit" class="submit" value="搜索" />
		</form>
	</div>
	<!-- 搜索区域结束-->
	<!-- 主区域开始 -->
	<div id="main_part">
		<div class="center">
			<h3 class="title">
				全部商品 <span class="num"></span>
			</h3>
			<div class="content">
				<input type="checkbox" name="" class="checkbox"  id="checkbox">
				<label for="" class="all">全选</label>
				<label for="" class="goods">商品</label>
				<label for="" class="price">单价(元)</label>
				<label for="" class="quantity">数量</label>
				<label for="" class="sum">小计(元)</label>
				<label for="" class="action">操作</label>
			</div>
			<div class="jd_sell">
<!-- 				<input type="checkbox" name="" class="checkbox" id="">
-->				<label for="" class="all" style="background: #fff"></label>
</div>

<script type="text/javascript">

	$(function(){
		$('[type=checkbox]').prop('checked',true);
		$('#checkbox').click(function() {
			$(this).prop('checked',function(i,val)
			{
				$(".check").prop('checked',val);
			});

		});

	})

	function num(obj)
	{

		var num = $(obj).val();
		var mix_id = $(obj).siblings('.mix_id').val();
		$.post('<?php echo U("Home/Index/num") ?>', {num: num,mix_id:mix_id}, function(data) {

		},'json');
	}
	function delGood(obj)
	{
		if (confirm('确实删除吗?')) {
			var mix_id = $(obj).parents('.item_show').eq(0).find('input.mix_id').val();
			$.post('<?php echo U("Home/Index/delGood") ?>', {mix_id:mix_id}, function(data) {
				if (data) {
					$(obj).parents('.item_show').remove();
				};
			},'text');
		};
	}


</script>
<?php foreach ($goods as $k => $v): ?>

	<div class="item_show">

		<div class="item_select">
			<input type="checkbox" class="check" name="">
		</div>
		<ul class="item_ul">
			<li class="img">
				<a href="" title="">
					<img src="<?php echo $v['pic'] ?>" width=80>
				</a>
			</li>
			<li class="item_name">
				<p class="title_item">
					<?php echo $v['good']['goods_name'] ?>
				</p>
				<p class="gift">
					<span class="icon-gift"></span>
					<a href="" title="">购买礼品包装</a>
				</p>
				<p class="service">
					<span class="icon-fullscreen"></span>
					<a href="" title="">购买京东服务</a>
				</p>
			</li>
			<li class="config">
				<?php foreach ((array)$v['attrs'] as $a => $b): ?>
					<p class="color"><?php echo $b['attr_name'] ?>：<?php echo $b['attr_values'] ?></p>
				<?php endforeach ?>
			</li>
			<li class="price">
				<p class="price_num"><?php echo $v['prices'] ?></p>
			</li>
			<li class="add_good">
				<label class="reduce" onclick="jian(this)">-</label>
				<input type="hidden" name="mix_id" class="mix_id" value="<?php echo $v['mix_id'] ?>">
				<input type="hidden" name="goods_id" class="goods_id" value="<?php echo $v['good']['goods_id'] ?>">
				<input type="hidden" name="quantity" class="quantity" value="<?php echo $v['shopstore']['store_num'] ?>">
				<input type="text" class="singleprice buy-num" onchange="num(this)" name="" value="<?php echo $v['buynum'] ?>">
				<label for="" class="add buy-num" onclick="jia(this)">+</label>
				<p class="have_good">有货</p>
			</li>
			<li class="subtotal">
				<p class="sub_num"></p>
			</li>
			<li class="action">
				<p class="delete">
					<a href="javascript:void(0)" onclick="delGood(this)" class="del">删除</a>
				</p>
				<p class="focus">
					<a href="javascript:focus(<?php echo $v['good']['goods_id'] ?>)" class="move">移到我的关注</a>
				</p>
			</li>
			<li class="donation">

			</li>
		</ul>

	</div>
<?php endforeach ?>
<script type="text/javascript">
	function focus(id)
	{
		$.post('<?php echo U("Home/Index/focus") ?>', {goods_id:id}, function(data) {
			hd_alert({
				message: data.message,
				timeout: 3
			})
		});
	}
	function setAmount()
	{

		var input = $('.buy-num');
		var storeNum =  input.siblings('[name=quantity]').val()*1;
		var num = input.val();
		if (num >= storeNum) {
			num = storeNum;
		}
		if (num <= 1) {
			num = 1;
		}
		input.val(num);

	}
	function jia(obj) {

		var input = $(obj);
		var storeNum = input.siblings('[name=quantity]').val()*1;
		var num = input.siblings('.buy-num').val() * 1 + 1;

		if (num >= storeNum) {
			num = storeNum;
		}

		input.siblings('.buy-num').val(num);

		var nums = $(obj).siblings('input.buy-num').val();
		var mix_id = $(obj).siblings('input.buy-num').siblings('.mix_id').val();
		$.post('<?php echo U("Home/Index/num") ?>', {num: nums,mix_id:mix_id}, function(data) {

		},'json');

	}

	function jian(obj) {
		var input = $(obj);
		var num = input.siblings('.buy-num').val() * 1 - 1;
		if (num <= 1) {
			num = 1;
		}
		input.siblings('.buy-num').val(num);
		var nums = $(obj).siblings('input.buy-num').val();
		var mix_id = $(obj).siblings('input.buy-num').siblings('.mix_id').val();
		$.post('<?php echo U("Home/Index/num") ?>', {num: nums,mix_id:mix_id}, function(data) {

		},'json');
	}


</script>
<script type="text/javascript">
	$(function(){
		$('.sub_num').each(function(i) {
			var price_num = $('.price_num').eq(i).html()*1;
			var singleprice = $('.singleprice').eq(i).val()*1;
			$('.sub_num').eq(i).html(price_num*singleprice);
		});
		var total_price = 0;
		$('.sub_num').each(function(c) {
			total_price+=$('.sub_num').eq(c).html()*1;
		});
		$('#total_price_num').html(total_price);

	})
</script>


<div class="settle_account">
	<div class="price_detail">
		<section class="left">

		</section>
		<section class="right">
			<label class="total_price">总价: <span>￥</span><span id="total_price_num" >0</span></label>
		</section>
	</div>
	<a href="<?php echo U('Member/Index/balance') ?>" onclick="" class="make_account">
		去结算
	</a>

</div>
</div>
</div>
<!-- 主区域结束 -->
<!-- <div style="height:1000px;"></div> -->
<!-- 底部服务开始 -->
<div id="service" style="border-top:1px solid #dcdcdc;padding-top:10px;">
	<div class="part">
		<h3>购物指南</h3>
		<a href="">购物流程</a>
		<a href="">会员介绍</a>
		<a href="">生活旅行/团购</a>
		<a href="">常见问题</a>
		<a href="">大家电</a>
		<a href="">联系客服</a>
	</div>
	<div class="part2">
		<h3>配送方式</h3>
		<a href="">上门自提</a>
		<a href="">211限时达</a>
		<a href="">配送服务查询</a>
		<a href="">配送费收取标准</a>
		<a href="">海外配送</a>
	</div>
	<div class="part">
		<h3>支付方式</h3>
		<a href="">货到付款</a>
		<a href="">在线支付</a>
		<a href="">分期付款</a>
		<a href="">邮局汇款</a>
		<a href="">公司转账</a>
	</div>
	<div class="part">
		<h3>售后服务</h3>
		<a href="">售后政策</a>
		<a href="">价格保护</a>
		<a href="">退款说明</a>
		<a href="">返修/退换货</a>
		<a href="">取消订单</a>
	</div>
	<div class="part5">
		<h3>特色服务</h3>
		<a href="">夺宝岛</a>
		<a href="">DIY装机</a>
		<a href="">延保服务</a>
		<a href="">京东E卡</a>
		<a href="">京东通信</a>
	</div>
	<div class="part6">
		<h3>京东自营覆盖区县</h3>
		<p>京东已向全国1978个区县提供自营配送服务，支持货到付款、OS机刷卡和售后上门服务。</p>
		<a href="">查看详情 ></a>
	</div>
</div>
<!-- 底部服务结束 -->
<!-- 底部索引开始 -->
<div id="index">
	<p class="first">
		<a href="">关于我们</a>|
		<a href="">联系我们</a>|
		<a href="">商家入驻</a>|
		<a href="">营销中心</a>|
		<a href="">手机京东</a>|
		<a href="">友情链接</a>|
		<a href="">销售联盟</a>|
		<a href="">京东社区</a>|
		<a href="">京东公益</a>|
		<a href="">English Site</a>|
		<a href="">Contact Us</a>
	</p>
	<p class="second">
		<span>北京市公安局朝阳分局备案编号110105014669</span>|
		<span>京ICP证070359号</span>|
		<a href="">互联网药品信息服务资格证编号(京)-经营性-2014-0008</a>|
		<span>新出发京零 字第大120007号</span>
	</p>
	<p class="third">
		<a href="">音像制品经营许可证苏宿批005号</a>|
		<span>出版物经营许可证编号新出发(苏)批字第N-012号</span>|
		<span>互联网出版许可证编号新出网证(京)字150号</span>
	</p>
	<p class="fourth">
		<a href="">网络文化经营许可证京网文[2014]2148-348号  </a>
		<span>违法和不良信息举报电话：4006561155  Copyright © 2004-2015  京东JD.com 版权所有</span>
	</p>
	<p class="fifth">
		<span>京东旗下网站:</span>
		<a href="">360TOP</a>
		<a href="">拍拍网</a>
		<a href="">网银在线</a>
	</p>
	<div class="img">
		<img src="images/v.png" height="32" width="103" alt="" />
		<img src="images/v1.png" height="32" width="103" alt="" />
		<img src="images/v3.png" height="32" width="103" alt="" />
		<img src="images/v4.png" height="32" width="103" alt="" />
		<img src="images/v7.png" height="32" width="185" alt="" />
		<img src="images/v5.jpg" height="32" width="103" alt="" />
	</div>
</div>
<!-- 底部索引结束 -->
</body>
</html>